package com.tobey.logfetch.controller;

import com.tobey.logfetch.util.RemoteExecuteCommand;
import com.tobey.logfetch.vo.ResultVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author tangbing
 * @date 2019/12/31 17:18
 */
@Api(value = "test", description = "测试")
@RestController
@RequestMapping(value = "/test")
public class TestController {

    /**
     * @param ip
     * @param pwd
     * @param no     新收费站号 4位
     * @param laneNo 车道号
     * @return
     */
    @ApiOperation(value = "连接ssh", notes = "连接ssh")
    @GetMapping("connect/{ip}/{pwd}/{no}/{laneNo}")
    public ResultVo connect(@PathVariable("ip") String ip, @PathVariable("pwd") String pwd, @PathVariable("no") String no, @PathVariable("laneNo") String laneNo) {
        return RemoteExecuteCommand.sshCommand(ip, pwd, no, laneNo);
    }
}
